/*
 * @Date         : 2024-05-11 19:43:13 星期6
 * @Author       : xut
 * @Description  :
 */
const grpc = require("@grpc/grpc-js")
const messages = require("./gen/helloworld_pb")
const services = require("./gen/helloworld_grpc_pb")

function main() {
  const client = new services.GreeterClient(
    "localhost:50051",
    grpc.credentials.createInsecure()
  )
  const request = new messages.HelloRequest()

  request.setName("tom")
  client.sayHello(request, (err, res) => {
    console.log("Greeting:", res.getMessage())
  })
}
main()
